﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;

namespace ToddMcDermid.SSIS
{
    #region CLASS: DtsRowDispositions
    public class DtsRowDispositions
    {
        #region STRUCT: DtsRowDispositionDescriptionStruct
        public struct DtsRowDispositionDescriptionStruct
        {
            #region Private Variables
            private readonly DTSRowDisposition _rowDisposition;
            private readonly string _description;
            #endregion

            #region Constructor
            public DtsRowDispositionDescriptionStruct(DTSRowDisposition rowDisposition, string description)
            {
                this._rowDisposition = rowDisposition;
                this._description = description;
            }
            #endregion

            #region Public Properties
            public DTSRowDisposition DTSRowDisposition
            {
                get { return this._rowDisposition; }
            }

            public string Description
            {
                get { return this._description; }
            }
            #endregion
        }

        #region Static Variables
        private static readonly DtsRowDispositionDescriptionStruct __empty;
        public static readonly DtsRowDispositionDescriptionStruct[] DtsRowDispositionDescriptions;
        public static readonly DtsRowDispositionDescriptionStruct[] DtsRowDispositionDescriptionsWithoutNotUsed;
        #endregion

        #region Static Constructor
        static DtsRowDispositions()
        {
            DtsRowDispositions.__empty = new DtsRowDispositionDescriptionStruct();

            DtsRowDispositions.DtsRowDispositionDescriptions = new DtsRowDispositionDescriptionStruct[4];
            DtsRowDispositions.DtsRowDispositionDescriptions[0] = new DtsRowDispositionDescriptionStruct(DTSRowDisposition.RD_NotUsed, "Error Output is not used.");
            DtsRowDispositions.DtsRowDispositionDescriptions[1] = new DtsRowDispositionDescriptionStruct(DTSRowDisposition.RD_IgnoreFailure, "Errors are ignored.");
            DtsRowDispositions.DtsRowDispositionDescriptions[2] = new DtsRowDispositionDescriptionStruct(DTSRowDisposition.RD_FailComponent, "Errors fail the component.");
            DtsRowDispositions.DtsRowDispositionDescriptions[3] = new DtsRowDispositionDescriptionStruct(DTSRowDisposition.RD_RedirectRow, "Errors redirect the row to the error output.");

            DtsRowDispositions.DtsRowDispositionDescriptionsWithoutNotUsed = new DtsRowDispositionDescriptionStruct[3];
            DtsRowDispositions.DtsRowDispositionDescriptionsWithoutNotUsed[0] = DtsRowDispositions.DtsRowDispositionDescriptions[1];
            DtsRowDispositions.DtsRowDispositionDescriptionsWithoutNotUsed[1] = DtsRowDispositions.DtsRowDispositionDescriptions[2];
            DtsRowDispositions.DtsRowDispositionDescriptionsWithoutNotUsed[2] = DtsRowDispositions.DtsRowDispositionDescriptions[3];
        }
        #endregion
        #endregion
    }
    #endregion
}
